{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "    age  gender\n",
      "0    20       1\n",
      "8    37       1\n",
      "4    29       1\n",
      "17   35       0\n",
      "3    26       1\n",
      "10   21       0\n",
      "9    20       0\n",
      "12   26       0\n",
      "14   30       0\n",
      "16   34       0\n",
      "11   25       0\n",
      "1    23       1\n",
      "7    33       1\n",
      "5    30       1\n",
      "6    31       1\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0.3333333333333333"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "from sklearn.tree import DecisionTreeClassifier\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.metrics import accuracy_score\n",
    "\n",
    "music_data = pd.read_csv('music.csv')\n",
    "X = music_data.drop(columns=['genre']) # is the result\n",
    "y = music_data['genre']\n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.8)\n",
    "# print(X_train)\n",
    "print(X_test)\n",
    "\n",
    "model = DecisionTreeClassifier()\n",
    "model.fit(X_train, y_train)\n",
    "\n",
    "predictions = model.predict(X_test)\n",
    "\n",
    "score = accuracy_score(y_test, predictions)\n",
    "score"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "d80dceb8e76061e928794bb3ce8fa9d0c2b7abe9c550ab61d3fca5a520d3bcb0"
  },
  "kernelspec": {
   "display_name": "Python 3.8.6 64-bit",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.6"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
